package one.bugu.android.demon.bean;

import com.juefeng.android.framework.update.ResultUpdateVersion;

import java.text.DecimalFormat;

/**
 * Created with IntelliJ IDEA.
 * User: LangK
 * Created Date 2018/9/10
 * Time: 13:53
 * Description:版本更新
 */
public class CheckUpdateBean implements ResultUpdateVersion {


    private String verName;
    private int verCode;
    private String fileSize;
    private String url;
    private boolean isUpdate;
    private String desc;
    private double rewardBgt;
    private String brSymbol;

    public double getRewardPower() {
        return rewardBgt;
    }

    public void setRewardPower(double rewardPower) {
        this.rewardBgt = rewardPower;
    }

    public String getBrSymbol() {
        return brSymbol;
    }

    public void setBrSymbol(String brSymbol) {
        this.brSymbol = brSymbol;
    }

    public CheckUpdateBean() {
        super();
    }
    @Override
    public String getUpdataGive() {
        return new DecimalFormat("###").format(rewardBgt);
    }

    @Override
    public boolean isForceUpdate() {
        return isUpdate;
    }

    @Override
    public boolean isUpdate() {
        int version = 1;
        if (version == verCode) {
            return false;
        } else {
            return true;
        }
    }

    @Override
    public String getContent() {
        return this.desc;
    }

    @Override
    public String getVersionCode() {
        String code = String.valueOf(verCode);
        StringBuilder builder = new StringBuilder();
        try{
            for (int i = 0; i < code.length(); i++) {
                builder.append(code.charAt(i));
                if(i != code.length() - 1){
                    builder.append(".");
                }
            }
            code = builder.toString();
        }catch (Exception e){
            e.printStackTrace();
        }
        return code;
    }

    @Override
    public String getVersionBrSymbol() {
        return brSymbol;
    }

    @Override
    public String getDownlogUrl() {
        return this.url;
    }

    public String getVerName() {
        return verName;
    }

    public void setVerName(String verName) {
        this.verName = verName;
    }

    public int getVerCode() {
        return verCode;
    }

    public void setVerCode(int verCode) {
        this.verCode = verCode;
    }

    public String getFileSize() {
        return fileSize;
    }

    public void setFileSize(String fileSize) {
        this.fileSize = fileSize;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public boolean getIsUpdate() {
        return isUpdate;
    }

    public void setIsUpdate(boolean isUpdate) {
        this.isUpdate = isUpdate;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
